<script setup lang="ts">
// 地区选择器
import { codeToText, regionData } from 'element-china-area-data'
//赋值给级联选择器
const options = ref(regionData)
const addressareaid = ref()
const selectedOptions = ref([])
const temp = 110102
const handleChange = () => {
  const str =
    codeToText[selectedOptions.value[0]] +
    '/' +
    codeToText[selectedOptions.value[1]] +
    '/' +
    codeToText[selectedOptions.value[2]]

  console.log('selectedOptions.value[0]', selectedOptions.value[0])
  console.log('selectedOptions.value[1]', selectedOptions.value[1])
  console.log('selectedOptions.value[2]', selectedOptions.value[2])
  // console.log('selectedOptions.value[0]',codeToText[11])
  // console.log('selectedOptions.value[1]',codeToText[1102])
  // console.log('selectedOptions.value[2]',codeToText[110228])
  console.log(str)
  addressareaid.value = selectedOptions.value[2]
  // console.log(addressareaid.value)
}
// handleChange()
</script>

<template>
  <div>
    <div>
      <el-cascader
        size="default"
        :options="options"
        v-model="selectedOptions"
        @change="handleChange"
      />
      {{}}
    </div>
  </div>
</template>

<style lang="scss" scoped></style>
